package com.hy.erp.inventory.service;

import java.util.List ;

import javax.ejb.Stateless ;

import org.jboss.seam.ScopeType ;
import org.jboss.seam.annotations.Name ;
import org.jboss.seam.annotations.Scope ;

import com.hy.enterprise.framework.service.business.AbstractBusinessService;
import com.hy.erp.inventory.dao.ProductCharacteristicTypeDao;
import com.hy.erp.inventory.dao.interfaces.IProductCharacteristicTypeDao;
import com.hy.erp.inventory.pojo.ProductCharacteristicType;
import com.hy.erp.inventory.pojo.interfaces.IProductCharacteristicType;
import com.hy.erp.inventory.service.interfaces.IProductCharacteristicTypeService;

/**
 * 
 * <ul>
 * <li>开发作者：李冰</li>
 * <li>设计日期：2010-12-18；时间：上午11:40:40</li>
 * <li>类型名称：ProductCharacteristicTypeService</li>
 * <li>设计目的：</li>
 * </ul>
 * <ul>
 * <b>修订编号：</b>
 * <li>修订日期：</li>
 * <li>修订作者：</li>
 * <li>修订原因：</li>
 * <li>修订内容：</li>
 * </ul>
 */@ Name ( "productCharacteristicTypeService" )
 @ Scope ( ScopeType.STATELESS )
 @ Stateless
public class ProductCharacteristicTypeService extends AbstractBusinessService < IProductCharacteristicType > implements IProductCharacteristicTypeService
{

	@ Override
	public boolean addProductCharacteristicType (
													ProductCharacteristicType productCharacteristicType )
	{

		if ( null == productCharacteristicType)
	{
		return true ;
	}
	
	else
	{
		IProductCharacteristicTypeDao productCharacteristicTypeDao =
		                       ( ProductCharacteristicTypeDao ) this
		                                          .getDao ( IProductCharacteristicType.class ) ;
		
		IProductCharacteristicType iProductCharacteristicType=productCharacteristicType;
		
		return productCharacteristicTypeDao
		                .persist ( iProductCharacteristicType ) ;
	}
	
	}

	@ Override
	public String [ ] addProductCharacteristicType (
														Object [ ] productCharacteristicType )
	{

		if ( null == productCharacteristicType)
		{
			return null ;
		}
		
		else
		{
			

			IProductCharacteristicTypeDao productCharacteristicTypeDao =
                ( ProductCharacteristicTypeDao ) this
                                   .getDao ( IProductCharacteristicType.class ) ;

			ProductCharacteristicType[] productCharacteristicTypes=new ProductCharacteristicType[productCharacteristicType.length];
			for(int i=0;i<productCharacteristicType.length;i++)
			{
				ProductCharacteristicType productCharacteristicType2=( ProductCharacteristicType) productCharacteristicType[i];
				productCharacteristicTypes[i]=productCharacteristicType2;
			}
			
			return productCharacteristicTypeDao
			                .persist ( productCharacteristicTypes ) ;
		}
		
	
	}

	@ Override
	public boolean modifyProductCharacteristicType (
														ProductCharacteristicType productCharacteristicType )
	{

		if ( null == productCharacteristicType)
	{
		return true ;
	}
	
	else
	{
		IProductCharacteristicTypeDao productCharacteristicTypeDao =
		                       ( ProductCharacteristicTypeDao ) this
		                                          .getDao ( IProductCharacteristicType.class ) ;
		
		IProductCharacteristicType iProductCharacteristicType=productCharacteristicType;
		
		return productCharacteristicTypeDao
		                .merge ( iProductCharacteristicType ) != null ;
	}
	
	}

	@ Override
	public String [ ] modifyProductCharacteristicType (
														Object [ ] productCharacteristicType )
	{



		if ( null == productCharacteristicType )
		{
			return null ;
		}

		else
		{

			IProductCharacteristicTypeDao productCharacteristicTypeDao =
                ( ProductCharacteristicTypeDao ) this
                                   .getDao ( IProductCharacteristicType.class ) ;

			ProductCharacteristicType[] productCharacteristicTypes=new ProductCharacteristicType[productCharacteristicType.length];
			for(int i=0;i<productCharacteristicType.length;i++)
			{
				ProductCharacteristicType productCharacteristicType2=( ProductCharacteristicType ) productCharacteristicType[i];
				productCharacteristicTypes[i]=productCharacteristicType2;
			}
			
			

			return productCharacteristicTypeDao
								.merge   ( productCharacteristicTypes ) ;
		}
	
	
	}

	@ Override
	public Integer removeProductCharacteristicType (
														String [ ] productCharacteristicTypeIds )
	{
		if ( ( null == productCharacteristicTypeIds )
			     || ( productCharacteristicTypeIds.length == 0 ) )
		{
			return new Integer (
			                     0 ) ;
		}
		else
		{

			IProductCharacteristicTypeDao productCharacteristicTypeDao =
                ( ProductCharacteristicTypeDao ) this
                                   .getDao ( IProductCharacteristicType.class ) ;
			return productCharacteristicTypeDao
			                .remove ( productCharacteristicTypeIds ) ;
		}
		
	}

	@ Override
	public List < IProductCharacteristicType > getAllProductCharacteristicType ( )
	{
		return null ;
	}

}
